package com.liu.article.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import com.liu.article.pojo.Article;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

/**
 * 数据访问接口
 * @author Administrator
 *
 */
public interface ArticleDao extends JpaRepository<Article,String>,JpaSpecificationExecutor<Article>{

    /**
     * 根据主键来 增加点赞数
     * @param articleId
     */
    @Modifying
    @Query(value = "update tb_article set thumbup=thumbup+1 WHERE id=?",nativeQuery = true)
    public  void AddThumbup(String articleId);

    /**
     * 根据主键更新审核状态
     * @param articleId
     */
    @Modifying
    @Query(value = "update tb_article set state=1 WHERE id=?",nativeQuery = true)
    public  void updateState(String articleId);
	
}
